﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GU.WebERP.Core.AjaxFx
{
    /// <summary>
    /// 指示方法用于 Ajax 调用
    /// </summary>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
    public class AjaxFxMethodAttribute : Attribute
    {
        /// <summary>
        /// 方法编码
        /// </summary>
        public string Code
        {
            get;
            set;
        }

        /// <summary>
        /// 方法名称
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// 描述
        /// </summary>
        public string Description
        {
            get;
            set;
        }

        /// <summary>
        /// 是否需要 Session
        /// </summary>
        public bool MustSession
        {
            get;
            set;
        }

        /// <summary>
        /// 是否保存调用日志
        /// </summary>
        public bool Log
        {
            get;
            set;
        }

        /// <summary>
        /// 指示方法用于 Ajax 调用
        /// </summary>
        /// <param name="code">方法编码</param>
        /// <param name="description">描述</param>
        public AjaxFxMethodAttribute(string code, string description)
        {
            this.Code = code;
            this.Description = description;
        }

        /// <summary>
        /// 指示方法用于 Ajax 调用
        /// </summary>
        /// <param name="code">方法编码</param>
        /// <param name="description">描述</param>
        /// <param name="mustSession">是否需要 Session</param>
        public AjaxFxMethodAttribute(string code, string description, bool mustSession)
            : this(code, description)
        {
            this.MustSession = MustSession;
        }
    }
}